/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entidades;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Damian
 */
@Entity
@Table(name = "offer_day_month")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OfferDayMonth.findAll", query = "SELECT o FROM OfferDayMonth o"),
    @NamedQuery(name = "OfferDayMonth.findByIdOfferDayMonth", query = "SELECT o FROM OfferDayMonth o WHERE o.idOfferDayMonth = :idOfferDayMonth"),
    @NamedQuery(name = "OfferDayMonth.findByDay", query = "SELECT o FROM OfferDayMonth o WHERE o.day = :day"),
    @NamedQuery(name = "OfferDayMonth.findByMonth", query = "SELECT o FROM OfferDayMonth o WHERE o.month = :month")})
public class OfferDayMonth implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_OFFER_DAY_MONTH")
    private Integer idOfferDayMonth;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DAY")
    private int day;
    @Basic(optional = false)
    @NotNull
    @Column(name = "MONTH")
    private int month;
    @JoinColumn(name = "ID_OFFER", referencedColumnName = "ID_OFFER")
    @ManyToOne(optional = false)
    private Offer idOffer;

    public OfferDayMonth() {
    }

    public OfferDayMonth(Integer idOfferDayMonth) {
        this.idOfferDayMonth = idOfferDayMonth;
    }

    public OfferDayMonth(Integer idOfferDayMonth, int day, int month) {
        this.idOfferDayMonth = idOfferDayMonth;
        this.day = day;
        this.month = month;
    }

    public Integer getIdOfferDayMonth() {
        return idOfferDayMonth;
    }

    public void setIdOfferDayMonth(Integer idOfferDayMonth) {
        this.idOfferDayMonth = idOfferDayMonth;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day = day;
    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public Offer getIdOffer() {
        return idOffer;
    }

    public void setIdOffer(Offer idOffer) {
        this.idOffer = idOffer;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOfferDayMonth != null ? idOfferDayMonth.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OfferDayMonth)) {
            return false;
        }
        OfferDayMonth other = (OfferDayMonth) object;
        if ((this.idOfferDayMonth == null && other.idOfferDayMonth != null) || (this.idOfferDayMonth != null && !this.idOfferDayMonth.equals(other.idOfferDayMonth))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.OfferDayMonth[ idOfferDayMonth=" + idOfferDayMonth + " ]";
    }
    
}
